From: Jens Frank Date: Thu, 6 May 2004 06:31:35 +0000 (+0000) Subject: Merged wfImagePath into Image class X-Git-Tag: 1.3.0beta1~139 X-Git-Url: http://git.cyclocoop.org/wiki/%27.%24skin%5B%27img%27%5D.%27?a=commitdiff_plain;h=96f47a6c5b59f4f5577a8ba84bb2409c205b1b64;p=lhc%2Fweb%2Fwiklou.git Merged wfImagePath into Image class --- diff --git a/includes/Image.php b/includes/Image.php index c183d46735..9b01e7814a 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -20,11 +20,16 @@ class Image function Image( $name ) { + global $wgUploadDirectory; + $this->name = $name; $this->title = Title::makeTitle( Namespace::getImage(), $this->name ); - $this->imagePath = wfImagePath( $name ); + //$this->imagePath = wfImagePath( $name ); + $hash = md5( $this->title->getDBkey() ); + $this->imagePath = $wgUploadDirectory . "/" . $hash{0} . "/" .substr( $hash, 0, 2 ) . "/{$name}"; + $this->url = $this->wfImageUrl( $name ); - + if ( $this->fileExists = file_exists( $this->imagePath ) ) // Sic!, "=" is intended { list($this->width, $this->height, $this->type, $this->attr) = getimagesize( $this->imagePath ); @@ -216,19 +221,3 @@ class Image } //class -// return path name of an image -// canonicalize name. -function wfImagePath( $imgname ) -{ - global $wgUploadDirectory; - - $nt = Title::newFromText( $imgname ); - if( !$nt ) return ""; - - $name = $nt->getDBkey(); - $hash = md5( $name ); - - $path = "{$wgUploadDirectory}/" . $hash{0} . "/" . - substr( $hash, 0, 2 ) . "/{$name}"; - return $path; -}